//
//  AirplaneDetailModel.swift
//  ImGuider X
//
//  Created by 王鹏宇 on 9/30/18.
//  Copyright © 2018 imguider. All rights reserved.
//

import UIKit
import CoreLocation

class AirportModel: NSObject,Codable {
    
    //属性修改
    //
    var  type,airport_name,lat,lng,continent,iso_country,iso_region,municipality,gps_code,iata_code,wikipedia_link,keywords,airport_cname,icao_code : String?
    
    var coor:CLLocationCoordinate2D? {
        
        guard let lat = lat,let lng = lng else {
            
            return nil
        }
        
        let coor = CLLocationCoordinate2D(latitude:Double(lat) ?? 0.0 , longitude: Double(lng) ?? 0.0)
        
        if CLLocationCoordinate2DIsValid(coor) {
            
            return coor
        }
        
        return nil
    }
    
}

class FlightDetail:NSObject, Codable {
    
    
    var flightNo,planeModel,arriveAirport,departureAirport:String?
    var arriveTime,departureTime:String?
    
    var arriveAirportObj,departureAirportObj:AirportModel?
}

class TransferModel:NSObject, Codable {
    //planeModel ---  airplaneModel
    //arriveTime ---  arriveDateTime
    //departureTime ---  departureDateTime
    //departureAirportObj --- airport
    //departureAirport   (CDG)
    
    var flightNo,planeModel,arriveAirport,departureAirport:String?
    var arriveTime,departureTime:String?
    
    var arriveAirportObj,departureAirportObj:AirportModel?
}

class AirplaneDetailModel: NSObject,Codable {
    
    // 去掉的属性
    //departureEquipment  departureFlight
    
    // 替换掉的属性
    // arrivalCity --- destinationCity
    // departureTime --- departureDate
    // airlineName   --- departureAirlineCompany
    // arriveTime  --- destinationDate
    // departureAirport -- departureAirportObj
    // arrivalAirportObj --  destinationAirport
    
    // 新增
    // departureAirport (PVG)  arrivalAirport (SYX)
    var departureCity,arrivalCity,departureTime,airlineName,reversionExplanation,arriveTime,departureAirport,arrivalAirport,flightNo: String?
    
    var departureAirportObj,arrivalAirportObj: AirportModel?
    
    var transfer : [TransferModel]?
    
    var flightDetail: [FlightDetail]?
}
